package com.gao.gLotusMusic.view;

import com.gao.musicApi.model.Song;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Popup;

import java.util.ArrayList;
import java.util.List;


public class PlayerList extends Popup {
    public static PlayerList instance = new PlayerList();
    private final Pane pane;
    private final SongTable tableView = new SongTable();

    private PlayerList() {
        setAutoHide(true);
        pane = new VBox();
        getScene().setRoot(pane);
        setBackground(Color.rgb(0x66, 0xcc, 0xff));
        pane.setPrefWidth(300);
        tableView.setPrefHeight(500);
        pane.setPrefHeight(500);
        pane.getChildren().add(tableView);
//        List<Song> songs = new ArrayList<>();
//        songs.add(new Song());
//        songs.add(new Song());
//        tableView.setitem(songs);
    }

    @Override
    protected void show() {
        if (isShowing()) {
            hide();
        } else {
            super.show();
        }
    }

    public void setBackground(Color color) {
        pane.setBackground(new Background(new BackgroundFill(color, null, null)));

    }
}
